<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<%@ page import="com.josiejune.documentdispatch.models.Document" %>
<%@ page import="com.josiejune.documentdispatch.models.DAO" %>
<%@ page import="com.josiejune.documentdispatch.servlets.views.FormatUtil" %>
<%@ page import="com.googlecode.objectify.Key" %>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="java.util.List" %>


<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
<title>View Document</title> 
	
  <link rel="stylesheet" href="styles/stencil/screen.css" type="text/css" media="screen" charset="utf-8" /> 
  <link rel="stylesheet" href="styles/stencil/print.css" type="text/css" media="print" charset="utf-8" /> 
  <link rel="stylesheet" href="styles/stencil/custom.css" type="text/css" media="screen" title="no title" charset="utf-8" /> 
  <link href="styles/stencil/lib/plugins/forms.css" rel="stylesheet" type="text/css" /> 
  <link href="styles/stencil/lib/plugins/buttons.css" rel="stylesheet" type="text/css" /> 
  <link href="styles/stencil/lib/plugins/grid.css" rel="stylesheet" type="text/css" /> 
  <link href="styles/stencil/lib/typography.css" rel="stylesheet" type="text/css" /> 
</head> 
<body id="index"> 
 
<div id="page" class="xgrid xfluid"> 
	
	<div id="header" class="x12">		
		<div class="xpad"> 
			<h1>View Document</h1>		
		</div> 
	</div> 
<%@ include file="headermenu.jsp" %>

	<% 
	String docId = request.getParameter("docId");
	DAO dao = new DAO();
	Document doc = dao.ofy().get(new Key<Document>(Document.class, Long.valueOf(docId)));

	
	%>


<div class="field">
	ID: <%= doc.getId() %>
</div>
<br/>
<div class="field">
	File: <a href="/download?msgId=<%=URLEncoder.encode(String.valueOf(doc.getParent().getId()), "UTF-8") %>&fileNum=1" ><%= doc.getFilename() %></a>
</div>
<br/>
<div class="field">
	File Size: <%= doc.getFileSize() %>
</div>
<br/>
<div class="field">
	Content Type: <%= doc.getContentType() %>
</div>
<br/>
<div class="field">
	Created: <%= FormatUtil.getDateTimeValue(doc.getCreatedDate()).toString() %>
</div>
<br/>
<div class="field">
	Modified: <%= FormatUtil.getDateTimeValue(doc.getModifiedTimestamp()).toString() %>
</div>
<br/>
<div class="field">
	<a href=ViewMsg.jsp?msgId=<%= doc.getParent().getId() %>>View Parent Message</a>
</div>
<br/>
<div class="field">
	Text Contents: <%= doc.getTextContents() %>
</div>

<br/>
</div>
</body> 
</html>